﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

public partial class my_givelist03 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string myuid = Request["myuid"].ToString();
            mylist.InnerHtml = Genlist(myuid);
        }
    }

    private string Genlist(string uid)
    {
        string result = "";
        result += "<table id=\"mymans\" border=\"0\" cellpadding=\"1\" cellspacing=\"2\" align=\"left\" width=80%>";
        result += "<thead>";
        result += "<tr height=30>";
        result += "<td align=center width=\"40\">序号</td>";
        result += "<td width=\"100\">姓名</td>";
        result += "<td>公司</td>";
        result += "<td>地址</td>";
        result += "<td width=\"60\">邮编</td>";
        result += "<td align=center width=\"60\">期刊</td>";
        result += "<td align=center width=\"40\">数量</td>";
        result += "<td align=center width=\"40\">级别</td>";
        result += "</tr>";
        result += "</thead>";
        string cdate = DateTime.Today.ToString("yyyy-M-d");
        int iNum = 1;
        result += "<tbody>";
        //汽车画报
        //string sSql = "select linkman,company,companyaddr,companypostcode,giveqty,givelvl from vw_givelist where status=4 and givebdate<='" + cdate + "' and giveedate>='" + cdate + "' and givemag like '%汽车画报%' and inman='"+uid+"' order by givelvl";
        string sSql = "select linkman,company,companyaddr,companypostcode,giveqty,givelvl from vw_givelist where status=4 and giveedate>='" + cdate + "' and givemag like '%汽车画报%' and inman='" + uid + "' order by givelvl,company,companyaddr,linkman";
        TSqlDBReader oList = new TSqlDBReader(sSql);
        while (oList.FDataReader.Read())
        {
            result += "<tr height=30>";
            result += "<td align=center width=\"40\">" + iNum.ToString() + "</td>";
            result += "<td width=\"100\">" + oList.FDataReader.GetValue(0).ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(1).ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(2).ToString() + "</td>";
            result += "<td width=\"60\">" + oList.FDataReader.GetValue(3).ToString() + "</td>";
            result += "<td align=center width=\"60\">汽车画报</td>";
            result += "<td align=center width=\"40\">" + oList.FDataReader.GetValue(4).ToString() + "</td>";
            result += "<td align=center width=\"40\">" + oList.FDataReader.GetValue(5).ToString() + "</td>";
            result += "</tr>";
            iNum++;
        }
        oList.Free();
        //动感驾驭
        //string sSql2 = "select linkman,company,companyaddr,companypostcode,giveqty,givelvl from vw_givelist where status=4 and givebdate<='" + cdate + "' and giveedate>='" + cdate + "' and givemag like '%动感驾驭%' and inman='" + uid + "' order by givelvl";
        string sSql2 = "select linkman,company,companyaddr,companypostcode,giveqty,givelvl from vw_givelist where status=4 and giveedate>='" + cdate + "' and givemag like '%动感驾驭%' and inman='" + uid + "' order by givelvl";
        TSqlDBReader2 oList2 = new TSqlDBReader2(sSql2);
        while (oList2.FDataReader.Read())
        {
            result += "<tr height=30>";
            result += "<td align=center width=\"40\">" + iNum.ToString() + "</td>";
            result += "<td width=\"100\">" + oList2.FDataReader.GetValue(0).ToString() + "</td>";
            result += "<td>" + oList2.FDataReader.GetValue(1).ToString() + "</td>";
            result += "<td>" + oList2.FDataReader.GetValue(2).ToString() + "</td>";
            result += "<td width=\"60\">" + oList2.FDataReader.GetValue(3).ToString() + "</td>";
            result += "<td align=center width=\"60\">动感驾驭</td>";
            result += "<td align=center width=\"40\">" + oList2.FDataReader.GetValue(4).ToString() + "</td>";
            result += "<td align=center width=\"40\">" + oList2.FDataReader.GetValue(5).ToString() + "</td>";
            result += "</tr>";
            iNum++;
        }
        oList2.Free();
        
        result += "</tbody>";
        result += "</table>";

        return result;
    }
}
